import request from '@/utils/request'

// 创建工厂
export function createFactory(data) {
  return request({
    url: '/base/factory/create',
    method: 'post',
    data: data
  })
}

// 更新工厂
export function updateFactory(data) {
  return request({
    url: '/base/factory/update',
    method: 'put',
    data: data
  })
}

// 删除工厂
export function deleteFactory(id) {
  return request({
    url: '/base/factory/delete?id=' + id,
    method: 'delete'
  })
}

// 获得工厂
export function getFactory(id) {
  return request({
    url: '/base/factory/get?id=' + id,
    method: 'get'
  })
}

// 获得工厂分页
export function getFactoryPage(query) {
  return request({
    url: '/base/factory/page',
    method: 'get',
    params: query
  })
}

// 获得工厂精简列表
export function getFactorySimple() {
  return request({
    url: '/base/factory/list-all-simple',
    method: 'get'
  })
}


// 导出工厂 Excel
export function exportFactoryExcel(query) {
  return request({
    url: '/base/factory/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
